﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NetCommand.Web  
{
    public class ReLogin : WebMessage
    {
        public override uint CLSID
        {
            get { return WebMessageDefine.id_ReLogin; }
        }
    }

    /// <summary>
    /// 获取验证码
    /// </summary>
    public class GetIdentifyCode : WebMessage
    {
        public string PhoneNumber = "";
        public override uint CLSID
        {
            get { return WebMessageDefine.id_GetIdentifyCode; }
        }
    }

    public class LoginMessage : WebMessage
    {
        public string userName = string.Empty;
        public string passWord = string.Empty;
        public override uint CLSID
        {
            get
            {
                return WebMessageDefine.id_LoginMessage;  
            }
        }
    }

    public class LoginResult : WebMessage
    {
        public override uint CLSID
        {
            get { return WebMessageDefine.id_LoginResult; }
        }
    }

    /// <summary>
    /// 修改密码
    /// </summary>
    public class ModifyPassword : WebMessage
    {
        public string UserName = "";    // 用户名
        public string OldPwd = "";      // 旧密码
        public string NewPwd = "";      // 新密码
        public string RepPwd = "";      // 重复

        public override uint CLSID
        {
            get { return WebMessageDefine.id_ModifyPwd; }
        }
    }

    public class ModifyPasswordResult : WebMessage
    {
        public override uint CLSID
        {
            get { return WebMessageDefine.id_ModifyPwdResult; }
        }
    }

    /// <summary>
    /// 注册
    /// </summary>
    public class RegisterUser : WebMessage
    {
        public string UserName = "";        // 用户名
        public string Password = "";        // 密码
        public string RepPassword = "";     // 重复密码
        public string NickName = "";        // 昵称
        public string AreaName = "";        // 单位名
        public string IdentifyCode = "";    // 验证码

        public override uint CLSID
        {
            get { return WebMessageDefine.id_RegisterUser; }
        }
    }

    public class RegistUserResult : WebMessage
    {
        public override uint CLSID
        {
            get { return WebMessageDefine.id_RegisterUserResult; }
        }
    }

    /// <summary>
    /// 控制开关输出状态
    /// </summary>
    public class GetSwitchState : WebMessage
    {
        public override uint CLSID
        {
            get { return WebMessageDefine.id_GetSwitchState; }
        }
    }

    public enum OpenState
    {
        NONE = -1,
        OPEN = 0, // 开
        CLOSE = 1 // 关
    }

    public enum StateModel
    {
        NONE = -1,
        AUTO = 0,
        TIMER = 1,
    }

    public class DeviceBase
    {
        public string DrvID = "";       // 编号
        public string DrvName = "";     // 名字
        public string DrvAddr = "";     // 地址
    }

    public class SwitchDeviceInfo : DeviceBase
    {
        public int State = 0;           // 开启状态
        public bool IsAuto = false;     // 是否自动， 不是自动即是手动
        public int TimerSurplus = 0;    // 定时器剩余时间长度 精确到秒
        public int ExecuteSurplus = 0;  // 执行剩余时间长度 精确到秒
    }

    /// <summary>
    /// 返回控制开关状态列表
    /// </summary>
    public class SwitchStateResult : WebMessage
    {
        public List<SwitchDeviceInfo> DeviceStateList = new List<SwitchDeviceInfo>();
        public override uint CLSID
        {
            get { return WebMessageDefine.id_SwitchStateResult; }
        }
    }

    public class RatioDeviceInfo : DeviceBase
    {
        public string DrvType = "";     // 类别
        public float Ratio = 0;         // 比例
        public float Number1 = 0;       // 数值1
    }

    /// <summary>
    /// 比例控制输出状态
    /// </summary>
    public class GetRatioOutputState : WebMessage
    {
        public override uint CLSID
        {
            get { return WebMessageDefine.id_GetRatioOutputState; }
        }
    }

    /// <summary>
    /// 比例控制输出状态列表
    /// </summary>
    public class RatioOutputStateResult : WebMessage
    {
        public List<RatioDeviceInfo> RatioDeviceList = new List<RatioDeviceInfo>();
        public override uint CLSID
        {
            get { return WebMessageDefine.id_RatioOutputStateResult; }
        }
    }

    public class DrvRealTimeData : DeviceBase
    {
        public string DrvType = "";     // 类别
        public float Number1 = 0;       // 数值1
        public float Number2 = 0;       // 数值2
    }

    /// <summary>
    /// 传感器实时接收数据
    /// </summary>
    public class GetRealTimeData : WebMessage
    {
        public override uint CLSID
        {
            get { return WebMessageDefine.id_GetRealtimeDeviceData; }
        }
    }

    public class RealTimeDataResult : WebMessage
    {
        public List<DrvRealTimeData> RealTimeDataList = new List<DrvRealTimeData>();
        public override uint CLSID
        {
            get { return WebMessageDefine.id_RealtimeDeviceDataResult; }
        }
    }

    /// <summary>
    /// TODO
    /// </summary>
    public class GetWheatherData : WebMessage
    {
        public override uint CLSID
        {
            get { return WebMessageDefine.id_GetWheatherData; }
        }
    }

    /// <summary>
    /// 设置输出设备
    /// </summary>
    public class SetDrvOutputState : WebMessage
    {
        public int MainCtrNo = 0;
        public string DrvNo = "";
        public string DrvType = "";
        public int Model = 0;
        public int OpenStae = 0;
    }
}